import {useCallback, useRef, useState} from "react";
import { ActionType } from "@ant-design/pro-components";
import {message} from "antd";
import {ProColumns} from "@ant-design/pro-table/lib";
import {getSongList} from "@/services/ant-design-pro/api";

export const useSongList = () => {
  // 表格实体的引用
  const actionRef = useRef<ActionType>();
  const [songList, setSongList] = useState([])

  const handleFetchListData = useCallback(async ({ current, pageSize, ...params }) => {
    const retData = {
      success: false,
      total: 0,
      data: []
    };
    const customParams = {
      page: current,
      page_size: pageSize,
    };

    try {
      const response = await getSongList(customParams);

    } catch (e) {
      message.error('数据请求异常');
    }
    return retData;
  }, [])

  return {
    actionRef,
    handleFetchListData,
  }
}
